package com.plum.admin.modules.sys.service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.plum.admin.modules.sys.dto.UserDTO;
import com.plum.admin.modules.sys.entity.SysUser;
import com.baomidou.mybatisplus.extension.service.IService;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * <p>
 * 用户表 服务类
 * </p>
 *
 * @author 子丶沫
 * @since 2021-08-13
 */
public interface ISysUserService extends IService<SysUser> {

    /**
     * 通过用户名查询用户
     * @param username
     * @return
     */
     SysUser findByUsername(String username);

    /**
     * 通过手机号码查询用户
     * @param mobile
     * @return
     */
     SysUser findByUserMobile(String mobile);

    /**
     * 通过邮箱查询用户
     * @param email
     * @return
     */
     SysUser findByEmail(String email);

    /**
     * 分页查询用户
     * @param page
     * @param userDTO
     * @return
     */
     IPage<SysUser> queryUserList(IPage<SysUser> page, UserDTO userDTO);

    /**
     * 删除用户
     * @param idList
     * @return
     */
    boolean deleteUser(List<String> idList);

    /**
     * 添加用户
     * @param userDTO
     * @return
     */
    boolean insertUser(UserDTO userDTO);

    /**
     * 修改用户
     * @param userDTO
     * @return
     */
    boolean updateUser(UserDTO userDTO);

    /**
     * 校验登录账号唯一性
     * @param username
     * @return
     */
    boolean checkUsername(String username);

    /**
     * 注册登录账号
     * @param userDTO
     * @param smsCode
     * @return
     */
    int register(UserDTO userDTO, String smsCode);

    /**
     * 修改密码
     * @param user
     * @param password
     * @param request
     */
    int updatePassword(SysUser user, String password, HttpServletRequest request);
}
